{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json, os, requests\n",
    "\n",
    "subscription_key = 'c4c5ef3d9a0c41b4b93f606d1e5fddfe'\n",
    "assert subscription_key\n",
    "\n",
    "face_api_url = 'https://qdtapi.cognitiveservices.azure.com/face/v1.0/detect'\n",
    "\n",
    "image_url = 'https://gitee.com/li_man_qi/python_start/raw/master/Python-week06/pictures/dl.jpg'\n",
    "\n",
    "headers = {'Ocp-Apim-Subscription-Key': subscription_key}\n",
    "\n",
    "params = {\n",
    "    'detectionModel': 'detection_01',\n",
    "     'returnFaceAttributes': 'age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise',\n",
    "    'returnFaceId': 'true'\n",
    "}\n",
    "\n",
    "response = requests.post(face_api_url, params=params,\n",
    "                         headers=headers, json={\"url\": image_url})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "results=response.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'faceId': 'b6be9f31-15f7-4a4e-91eb-0c043ea86908',\n",
       "  'faceRectangle': {'top': 81, 'left': 163, 'width': 118, 'height': 118},\n",
       "  'faceAttributes': {'smile': 0.883,\n",
       "   'headPose': {'pitch': -5.6, 'roll': -24.3, 'yaw': -8.6},\n",
       "   'gender': 'male',\n",
       "   'age': 20.0,\n",
       "   'facialHair': {'moustache': 0.1, 'beard': 0.1, 'sideburns': 0.1},\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.008,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 0.883,\n",
       "    'neutral': 0.109,\n",
       "    'sadness': 0.001,\n",
       "    'surprise': 0.0},\n",
       "   'blur': {'blurLevel': 'low', 'value': 0.0},\n",
       "   'exposure': {'exposureLevel': 'overExposure', 'value': 0.82},\n",
       "   'noise': {'noiseLevel': 'medium', 'value': 0.39},\n",
       "   'makeup': {'eyeMakeup': True, 'lipMakeup': True},\n",
       "   'accessories': [],\n",
       "   'occlusion': {'foreheadOccluded': False,\n",
       "    'eyeOccluded': False,\n",
       "    'mouthOccluded': False},\n",
       "   'hair': {'bald': 0.24,\n",
       "    'invisible': False,\n",
       "    'hairColor': [{'color': 'black', 'confidence': 0.99},\n",
       "     {'color': 'brown', 'confidence': 0.94},\n",
       "     {'color': 'other', 'confidence': 0.27},\n",
       "     {'color': 'gray', 'confidence': 0.18},\n",
       "     {'color': 'red', 'confidence': 0.08},\n",
       "     {'color': 'blond', 'confidence': 0.07},\n",
       "     {'color': 'white', 'confidence': 0.0}]}}}]"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'NoGlasses'"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['glasses']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.883"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['smile']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'color': 'black', 'confidence': 0.99},\n",
       " {'color': 'brown', 'confidence': 0.94},\n",
       " {'color': 'other', 'confidence': 0.27},\n",
       " {'color': 'gray', 'confidence': 0.18},\n",
       " {'color': 'red', 'confidence': 0.08},\n",
       " {'color': 'blond', 'confidence': 0.07},\n",
       " {'color': 'white', 'confidence': 0.0}]"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['hair']['hairColor']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "20.0"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['age']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'male'"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['gender']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [],
   "source": [
    "face_01=dict(glasses='NoGlasses',smile='0.883',hairColor=[\n",
    " {'color': 'black', 'confidence': 0.99},\n",
    " {'color': 'brown', 'confidence': 0.94},\n",
    " {'color': 'other', 'confidence': 0.27},\n",
    " {'color': 'gray', 'confidence': 0.18},\n",
    " {'color': 'red', 'confidence': 0.08},\n",
    " {'color': 'blond', 'confidence': 0.07},\n",
    " {'color': 'white', 'confidence': 0.0}],age='20.0',gender='male')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'glasses': 'NoGlasses',\n",
       " 'smile': '0.883',\n",
       " 'hairColor': [{'color': 'black', 'confidence': 0.99},\n",
       "  {'color': 'brown', 'confidence': 0.94},\n",
       "  {'color': 'other', 'confidence': 0.27},\n",
       "  {'color': 'gray', 'confidence': 0.18},\n",
       "  {'color': 'red', 'confidence': 0.08},\n",
       "  {'color': 'blond', 'confidence': 0.07},\n",
       "  {'color': 'white', 'confidence': 0.0}],\n",
       " 'age': '20.0',\n",
       " 'gender': 'male'}"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "face_01"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json, os, requests\n",
    "\n",
    "subscription_key = 'c4c5ef3d9a0c41b4b93f606d1e5fddfe'\n",
    "assert subscription_key\n",
    "\n",
    "face_api_url = 'https://qdtapi.cognitiveservices.azure.com/face/v1.0/detect'\n",
    "\n",
    "image_url = 'https://gitee.com/li_man_qi/python_start/raw/master/Python-week06/pictures/zxc.jpg'\n",
    "\n",
    "headers = {'Ocp-Apim-Subscription-Key': subscription_key}\n",
    "\n",
    "params = {\n",
    "    'detectionModel': 'detection_01',\n",
    "     'returnFaceAttributes': 'age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise',\n",
    "    'returnFaceId': 'true'\n",
    "}\n",
    "\n",
    "response = requests.post(face_api_url, params=params,\n",
    "                         headers=headers, json={\"url\": image_url})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [],
   "source": [
    "results=response.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'faceId': 'f4f6c185-ee10-45c5-ba9d-90c5ed2f3241',\n",
       "  'faceRectangle': {'top': 209, 'left': 423, 'width': 251, 'height': 251},\n",
       "  'faceAttributes': {'smile': 1.0,\n",
       "   'headPose': {'pitch': 6.5, 'roll': 4.1, 'yaw': 2.9},\n",
       "   'gender': 'male',\n",
       "   'age': 24.0,\n",
       "   'facialHair': {'moustache': 0.1, 'beard': 0.1, 'sideburns': 0.1},\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.0,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 1.0,\n",
       "    'neutral': 0.0,\n",
       "    'sadness': 0.0,\n",
       "    'surprise': 0.0},\n",
       "   'blur': {'blurLevel': 'medium', 'value': 0.34},\n",
       "   'exposure': {'exposureLevel': 'overExposure', 'value': 0.77},\n",
       "   'noise': {'noiseLevel': 'low', 'value': 0.25},\n",
       "   'makeup': {'eyeMakeup': True, 'lipMakeup': True},\n",
       "   'accessories': [],\n",
       "   'occlusion': {'foreheadOccluded': False,\n",
       "    'eyeOccluded': False,\n",
       "    'mouthOccluded': False},\n",
       "   'hair': {'bald': 0.05,\n",
       "    'invisible': False,\n",
       "    'hairColor': [{'color': 'black', 'confidence': 1.0},\n",
       "     {'color': 'brown', 'confidence': 0.82},\n",
       "     {'color': 'gray', 'confidence': 0.45},\n",
       "     {'color': 'other', 'confidence': 0.33},\n",
       "     {'color': 'blond', 'confidence': 0.07},\n",
       "     {'color': 'red', 'confidence': 0.02},\n",
       "     {'color': 'white', 'confidence': 0.0}]}}}]"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'NoGlasses'"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['glasses']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['smile']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'color': 'black', 'confidence': 1.0},\n",
       " {'color': 'brown', 'confidence': 0.82},\n",
       " {'color': 'gray', 'confidence': 0.45},\n",
       " {'color': 'other', 'confidence': 0.33},\n",
       " {'color': 'blond', 'confidence': 0.07},\n",
       " {'color': 'red', 'confidence': 0.02},\n",
       " {'color': 'white', 'confidence': 0.0}]"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['hair']['hairColor']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "24.0"
      ]
     },
     "execution_count": 79,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['age']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'male'"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['gender']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [],
   "source": [
    "face_02=dict(glasses='NoGlasses',smile='1.0',hairColor=[{'color': 'black', 'confidence': 1.0},\n",
    " {'color': 'brown', 'confidence': 0.82},\n",
    " {'color': 'gray', 'confidence': 0.45},\n",
    " {'color': 'other', 'confidence': 0.33},\n",
    " {'color': 'blond', 'confidence': 0.07},\n",
    " {'color': 'red', 'confidence': 0.02},\n",
    " {'color': 'white', 'confidence': 0.0}],age='24.0',gender='male')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'glasses': 'NoGlasses',\n",
       " 'smile': '1.0',\n",
       " 'hairColor': [{'color': 'black', 'confidence': 1.0},\n",
       "  {'color': 'brown', 'confidence': 0.82},\n",
       "  {'color': 'gray', 'confidence': 0.45},\n",
       "  {'color': 'other', 'confidence': 0.33},\n",
       "  {'color': 'blond', 'confidence': 0.07},\n",
       "  {'color': 'red', 'confidence': 0.02},\n",
       "  {'color': 'white', 'confidence': 0.0}],\n",
       " 'age': '24.0',\n",
       " 'gender': 'male'}"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "face_02"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json, os, requests\n",
    "\n",
    "subscription_key = 'c4c5ef3d9a0c41b4b93f606d1e5fddfe'\n",
    "assert subscription_key\n",
    "\n",
    "face_api_url = 'https://qdtapi.cognitiveservices.azure.com/face/v1.0/detect'\n",
    "\n",
    "image_url = 'https://gitee.com/li_man_qi/python_start/raw/master/Python-week06/pictures/cy.jpg'\n",
    "\n",
    "headers = {'Ocp-Apim-Subscription-Key': subscription_key}\n",
    "\n",
    "params = {\n",
    "    'detectionModel': 'detection_01',\n",
    "     'returnFaceAttributes': 'age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise',\n",
    "    'returnFaceId': 'true'\n",
    "}\n",
    "\n",
    "response = requests.post(face_api_url, params=params,\n",
    "                         headers=headers, json={\"url\": image_url})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [],
   "source": [
    "results=response.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'faceId': '50490cfc-93c5-41ee-bf27-612e96d29235',\n",
       "  'faceRectangle': {'top': 131, 'left': 283, 'width': 139, 'height': 139},\n",
       "  'faceAttributes': {'smile': 0.007,\n",
       "   'headPose': {'pitch': -1.0, 'roll': -0.8, 'yaw': 7.8},\n",
       "   'gender': 'male',\n",
       "   'age': 23.0,\n",
       "   'facialHair': {'moustache': 0.1, 'beard': 0.1, 'sideburns': 0.1},\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.0,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 0.007,\n",
       "    'neutral': 0.993,\n",
       "    'sadness': 0.0,\n",
       "    'surprise': 0.0},\n",
       "   'blur': {'blurLevel': 'medium', 'value': 0.46},\n",
       "   'exposure': {'exposureLevel': 'goodExposure', 'value': 0.52},\n",
       "   'noise': {'noiseLevel': 'medium', 'value': 0.63},\n",
       "   'makeup': {'eyeMakeup': True, 'lipMakeup': True},\n",
       "   'accessories': [],\n",
       "   'occlusion': {'foreheadOccluded': False,\n",
       "    'eyeOccluded': False,\n",
       "    'mouthOccluded': False},\n",
       "   'hair': {'bald': 0.02,\n",
       "    'invisible': False,\n",
       "    'hairColor': [{'color': 'black', 'confidence': 1.0},\n",
       "     {'color': 'brown', 'confidence': 0.97},\n",
       "     {'color': 'other', 'confidence': 0.22},\n",
       "     {'color': 'gray', 'confidence': 0.18},\n",
       "     {'color': 'red', 'confidence': 0.05},\n",
       "     {'color': 'blond', 'confidence': 0.03},\n",
       "     {'color': 'white', 'confidence': 0.0}]}}}]"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'NoGlasses'"
      ]
     },
     "execution_count": 88,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['glasses']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.007"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['smile']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'color': 'black', 'confidence': 1.0},\n",
       " {'color': 'brown', 'confidence': 0.97},\n",
       " {'color': 'other', 'confidence': 0.22},\n",
       " {'color': 'gray', 'confidence': 0.18},\n",
       " {'color': 'red', 'confidence': 0.05},\n",
       " {'color': 'blond', 'confidence': 0.03},\n",
       " {'color': 'white', 'confidence': 0.0}]"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['hair']['hairColor']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "23.0"
      ]
     },
     "execution_count": 91,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['age']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'male'"
      ]
     },
     "execution_count": 92,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['gender']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {},
   "outputs": [],
   "source": [
    "face_03=dict(glasses='NoGlasses',smile='0.007',hairColor=[{'color': 'black', 'confidence': 1.0},\n",
    " {'color': 'brown', 'confidence': 0.97},\n",
    " {'color': 'other', 'confidence': 0.22},\n",
    " {'color': 'gray', 'confidence': 0.18},\n",
    " {'color': 'red', 'confidence': 0.05},\n",
    " {'color': 'blond', 'confidence': 0.03},\n",
    " {'color': 'white', 'confidence': 0.0}],age='23.0',gender='male')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'glasses': 'NoGlasses',\n",
       " 'smile': '0.007',\n",
       " 'hairColor': [{'color': 'black', 'confidence': 1.0},\n",
       "  {'color': 'brown', 'confidence': 0.97},\n",
       "  {'color': 'other', 'confidence': 0.22},\n",
       "  {'color': 'gray', 'confidence': 0.18},\n",
       "  {'color': 'red', 'confidence': 0.05},\n",
       "  {'color': 'blond', 'confidence': 0.03},\n",
       "  {'color': 'white', 'confidence': 0.0}],\n",
       " 'age': '23.0',\n",
       " 'gender': 'male'}"
      ]
     },
     "execution_count": 94,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "face_03"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json, os, requests\n",
    "\n",
    "subscription_key = 'c4c5ef3d9a0c41b4b93f606d1e5fddfe'\n",
    "assert subscription_key\n",
    "\n",
    "face_api_url = 'https://qdtapi.cognitiveservices.azure.com/face/v1.0/detect'\n",
    "\n",
    "image_url = 'https://gitee.com/li_man_qi/python_start/raw/master/Python-week06/pictures/xgh.jpg'\n",
    "\n",
    "headers = {'Ocp-Apim-Subscription-Key': subscription_key}\n",
    "\n",
    "params = {\n",
    "    'detectionModel': 'detection_01',\n",
    "     'returnFaceAttributes': 'age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise',\n",
    "    'returnFaceId': 'true'\n",
    "}\n",
    "\n",
    "response = requests.post(face_api_url, params=params,\n",
    "                         headers=headers, json={\"url\": image_url})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {},
   "outputs": [],
   "source": [
    "results=response.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'faceId': 'ee0e6d6b-6be7-4798-a061-af0687689379',\n",
       "  'faceRectangle': {'top': 67, 'left': 279, 'width': 337, 'height': 337},\n",
       "  'faceAttributes': {'smile': 0.605,\n",
       "   'headPose': {'pitch': 13.1, 'roll': -18.7, 'yaw': -13.1},\n",
       "   'gender': 'male',\n",
       "   'age': 23.0,\n",
       "   'facialHair': {'moustache': 0.1, 'beard': 0.1, 'sideburns': 0.1},\n",
       "   'glasses': 'NoGlasses',\n",
       "   'emotion': {'anger': 0.0,\n",
       "    'contempt': 0.002,\n",
       "    'disgust': 0.0,\n",
       "    'fear': 0.0,\n",
       "    'happiness': 0.605,\n",
       "    'neutral': 0.393,\n",
       "    'sadness': 0.0,\n",
       "    'surprise': 0.0},\n",
       "   'blur': {'blurLevel': 'low', 'value': 0.0},\n",
       "   'exposure': {'exposureLevel': 'overExposure', 'value': 0.75},\n",
       "   'noise': {'noiseLevel': 'high', 'value': 0.73},\n",
       "   'makeup': {'eyeMakeup': True, 'lipMakeup': True},\n",
       "   'accessories': [],\n",
       "   'occlusion': {'foreheadOccluded': False,\n",
       "    'eyeOccluded': False,\n",
       "    'mouthOccluded': False},\n",
       "   'hair': {'bald': 0.07,\n",
       "    'invisible': False,\n",
       "    'hairColor': [{'color': 'brown', 'confidence': 0.99},\n",
       "     {'color': 'black', 'confidence': 0.98},\n",
       "     {'color': 'red', 'confidence': 0.13},\n",
       "     {'color': 'other', 'confidence': 0.13},\n",
       "     {'color': 'gray', 'confidence': 0.09},\n",
       "     {'color': 'blond', 'confidence': 0.06},\n",
       "     {'color': 'white', 'confidence': 0.0}]}}}]"
      ]
     },
     "execution_count": 97,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'NoGlasses'"
      ]
     },
     "execution_count": 98,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['glasses']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.605"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['smile']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'color': 'brown', 'confidence': 0.99},\n",
       " {'color': 'black', 'confidence': 0.98},\n",
       " {'color': 'red', 'confidence': 0.13},\n",
       " {'color': 'other', 'confidence': 0.13},\n",
       " {'color': 'gray', 'confidence': 0.09},\n",
       " {'color': 'blond', 'confidence': 0.06},\n",
       " {'color': 'white', 'confidence': 0.0}]"
      ]
     },
     "execution_count": 100,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['hair']['hairColor']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "23.0"
      ]
     },
     "execution_count": 101,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['age']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'male'"
      ]
     },
     "execution_count": 102,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[0]['faceAttributes']['gender']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {},
   "outputs": [],
   "source": [
    "face_04=dict(glasses='NoGlasses',smile='0.605',hairColor=[{'color': 'brown', 'confidence': 0.99},\n",
    " {'color': 'black', 'confidence': 0.98},\n",
    " {'color': 'red', 'confidence': 0.13},\n",
    " {'color': 'other', 'confidence': 0.13},\n",
    " {'color': 'gray', 'confidence': 0.09},\n",
    " {'color': 'blond', 'confidence': 0.06},\n",
    " {'color': 'white', 'confidence': 0.0}],age='23.0',gender='male')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'glasses': 'NoGlasses',\n",
       " 'smile': '0.605',\n",
       " 'hairColor': [{'color': 'brown', 'confidence': 0.99},\n",
       "  {'color': 'black', 'confidence': 0.98},\n",
       "  {'color': 'red', 'confidence': 0.13},\n",
       "  {'color': 'other', 'confidence': 0.13},\n",
       "  {'color': 'gray', 'confidence': 0.09},\n",
       "  {'color': 'blond', 'confidence': 0.06},\n",
       "  {'color': 'white', 'confidence': 0.0}],\n",
       " 'age': '23.0',\n",
       " 'gender': 'male'}"
      ]
     },
     "execution_count": 105,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "face_04"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
